﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using Eis51.CampanyCMS.Business.Bus;
using Eis51.CampanyCMS.Model.Bus;
using Eis51.Web.Admin;

namespace Eis51.CampanyCMS.WebUI.Admin.Baseinfo
{
    public partial class MaintainPage : BasePage
    {
        public int Seqno
        {
            get
            {
                if (Request.QueryString["Seqno"] != null)
                {
                    return int.Parse(Request.QueryString["Seqno"]);
                }
                return 0;
            
            }
        
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ShowData();
        }

        private void ShowData()
        {
            Maintain m = MaintainBLL.GetInstance().Get(new Maintain.Key(this.Seqno));
            if (m != null)
            {
               // lbBuyDate.Text = m.Buydate;
                lbDetail.Text = m.故障说明;
                lblink.Text = "用户姓名：" + m.用户姓名 + "<br> 联系电话：" + m.联系电话 + "<br> 联系地址" + m.联系地址 + "<br> 发票号：" + m.订单号;
                 lbName.Text = m.产品型号;
                 lbstatus.Text = m.Isdo == 0 ? "未处理" : "已处理";
               // lbReson.Text = m.Reson;
               // lbType.Text = m.Type;
               
            }
        
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
             Maintain m = MaintainBLL.GetInstance().Get(new Maintain.Key(this.Seqno));
             if (m != null)
             {
                 m.Isdo = m.Isdo == 0 ? 1 : 0;
                 MaintainBLL.GetInstance().Update(m);
                 lbstatus.Text = m.Isdo == 0 ? "未处理" : "已处理";
             }
        }

        protected void btnReturn_Click(object sender, EventArgs e)
        {
            Response.Redirect("MaintainList.aspx");
        }
    }
}
